<?
session_start();
//set widch height
$img_width=80;
$img_height=20;

srand(microtime() * 100000);
for($ti=0;$ti<4;$ti++){
        $new_number.=dechex(rand(0,15));
}

$_SESSION['check_auth_number']=$new_number;
$number_img=imageCreate($img_width,$img_height);
ImageColorAllocate($number_img,255,255,255);
for($i=1;$i<=128;$i++)
{
        imageString($number_img,1,mt_rand(1,$img_width),mt_rand(1,$img_height),"*",imageColorAllocate($number_img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255)));
}
for($i=0;$i<strlen($_SESSION[check_auth_number]);$i++)
{
        imageString($number_img,mt_rand(3,5),$i*$img_width/4+mt_rand(1,8),mt_rand(1,$img_height/4), $_SESSION[check_auth_number][$i],imageColorAllocate($number_img,mt_rand(0,100),mt_rand(0,150),mt_rand(0,200)));
}
header("Content-type: image/png");
ImagePng($number_img);
ImageDestroy($number_img);
?>
